home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / ResultObject.h < prev    next >
Text File  |  1995-06-12  |  6KB  |  144 lines

  1. /***********************************************************************\
  2. Common class providing a multiple-result interface in all Convert objects
  3. Copyright (C) 1993 David John Burrowes
  4.  
  5. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version.
  6.  
  7. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  8.  
  9. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  10.  
  11. The author, David John Burrowes, can be reached at:
  12.     davidjohn@kira.net.netcom.com
  13.     David John Burrowes
  14.     1926 Ivy #10
  15.     San Mateo, CA 94403-1367
  16. \***********************************************************************/
  17.  
  18. /*
  19. ====================================================================
  20. This is the interface file for the ResultObject class.  Full documentation for this class can be found in the ResultObject.rtf file.  I will not duplicate all that fine information here.
  21.     This is $Revision: 1.4 $ of this file
  22.     It was last modified by $Author: death $ on $Date: 93/04/04 23:45:08 $
  23. Note that this file was created while using the New Century Schoolbook Roman typeface.  You may find that some things line up strangely if you don't use that family.
  24. $Log:    ResultObject.h,v $
  25.  * Revision 1.4  93/04/04  23:45:08  death
  26.  * Sun Apr  4 23:45:07 PDT 1993
  27.  * 
  28.  * Revision 1.3  93/01/10  15:08:43  death
  29.  * Sun Jan 10 15:08:43 PST 1993
  30.  * 
  31.  * Revision 1.2  92/07/26  13:59:06  death
  32.  * Update of the result object...
  33.  * 
  34. ====================================================================
  35. */
  36.  
  37. //
  38. // Import our standard data type definitios
  39. //
  40. #import "common.h"
  41. #import <objc/Object.h>
  42. //
  43. //    Declare an struct for a data type, and a flag indicating whether we own
  44. //    the data or not (e.g. Objects are always not owned).
  45. //
  46. typedef struct
  47. {
  48.     DataType    StoredData;
  49.     Boolean        IOwnData;
  50. }
  51. StorageArea;
  52. //
  53. //    Declare the number of storage areas we can have (including the special ones for error code,
  54. //    error text and owr own error code), and the number of storage areas actually usable.
  55. //
  56. #define MAXAREAS 8
  57. #define    NUMSTORAGEAREAS    MAXAREAS - 3
  58.  
  59. //
  60. //    Now, define our interface.   Again, see the ResultObject.rtf document for general info.
  61. //
  62. @interface ResultObject:Object
  63. {
  64.     Integer    ErrorCode;
  65.     CString    ErrorText;
  66.     Boolean    IOwnErrorText;
  67.     //
  68.     //    Define an array of storage areas.  Note that we don't use storage area 0 for
  69.     //    now.  Probably reserving it for an error code generated by these routines.
  70.     //
  71.     StorageArea    ReturnVals[MAXAREAS];
  72. }
  73.  
  74. - (Instance) CopyCString: (CString) data;
  75. - (Instance) CopyCString: (CString) data Into: (Integer) reference;
  76. - (Instance) CopyPointer: (Pointer) data WithLength: (PositiveInteger) length ;
  77. - (Instance) CopyPointer: (Pointer) data WithLength: (PositiveInteger) length Into: (Integer) reference;
  78. - (Instance) init;
  79. - free;
  80. - (Boolean) GetBoolean;
  81. - (Boolean) GetBooleanFrom: (Integer) reference;
  82. - (Character) GetCharacter;
  83. - (Character) GetCharacterFrom: (Integer) reference;
  84. - (CString) GetCString;
  85. - (CString) GetCStringFrom: (Integer) reference;
  86. - (GenericType) GetDataWithType: (Integer) theType From: (Integer) storage;
  87. - (Integer) GetErrorCode;
  88. - (CString) GetErrorText;
  89. - (Integer) GetInteger;
  90. - (Integer) GetIntegerFrom: (Integer) reference;
  91. - (Integer) GetMyError;
  92. - (Instance) GetObject;
  93. - (Instance) GetObjectFrom: (Integer) reference;
  94. - (Pointer) GetPointer;
  95. - (Pointer) GetPointerFrom: (Integer) reference;
  96. - (PositiveInteger) GetPositiveInteger;
  97. - (PositiveInteger) GetPositiveIntegerFrom: (PositiveInteger) reference;
  98. - (Instance) PutBoolean: (Boolean) data Into: (Integer) reference;
  99. - (Instance) PutCharacter: (Character) data Into: (Integer) reference;
  100. - (Instance) PutCString: (CString) data Into: (Integer) reference;
  101. - (Instance) PutData: (GenericType) theData WithType: (Integer) theType
  102.     Into: (Integer) storage DoIOwn: (Boolean) ownit;
  103. - (Instance) PutInteger: (Integer) data Into: (Integer) reference;
  104. - (Instance) PutObject: (Instance) data Into: (Integer) reference;
  105. - (Instance) PutPointer: (Pointer) data Into: (Integer) reference;
  106. - (Instance) PutPositiveInteger: (PositiveInteger) data Into: (Integer) reference;
  107. - (Instance) ResetResults;
  108. - (Instance) StoreErrorCode: (Integer) code AndText: (CString) text;
  109. - (Instance) StoreErrorCode: (Integer) code AndCopyOfText: (CString) text;
  110. - (Instance) StoreBoolean: (Boolean) data;
  111. - (Instance) StoreCharacter: (Character) data;
  112. - (Instance) StoreCString: (CString) data;
  113. - (Instance) StoreInteger: (Integer) data;
  114. - (Instance) StoreMyError: (Integer) errorcode;
  115. - (Instance) StoreObject: (Instance) data;
  116. - (Instance) StorePointer: (Pointer) data;
  117. - (Instance) StorePositiveInteger: (PositiveInteger) data;
  118. @end
  119.  
  120.  
  121. /* Types used by ResultObjects */
  122. #define ERR_OK    0
  123. #define ERR_PEACHY    0
  124. #define ERR_ALLISWELL    0
  125. #define ERR_GROOVY    0
  126.  
  127. #define ERR_NOSUCHAREA -1234
  128. #define ERR_NOSUCHTYPE -1235
  129. #define ERR_CANTSTORE    -1236
  130.  
  131. /* Altnerate error defines.  I prefer this style, I think.  92.05.04 djb */
  132. #define    errOK    0
  133.  
  134. #define FIRST_RESULT    3
  135. #define SECOND_RESULT    4
  136. #define THIRD_RESULT    5
  137. #define FOURTH_RESULT    6
  138. #define FIFTH_RESULT    7
  139.  
  140. #define MYERROR_RESULT    0
  141. #define ERRORCODE_RESULT    1
  142. #define ERRORTEXT_RESULT    2
  143.  
  144.